<?php
$dbh=new PDO('mysql:host=localhost;dbname=zcjn','root','root');
$sql="select * from news";
$arr=$dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
?>
<table border="1">
    <tr>
        <td>编号</td>
        <td>新闻标题</td>
        <td>新闻内容</td>
        <td>点击进入详情页</td>
    </tr>
    <?php foreach($arr as $key=>$value) { ?>
        <tr>
            <td><?php echo $value['id']?></td>
            <td><?php echo $value['news_name']?></td>
            <td><?php echo $value['news_instr']?></td>
            <td>
                <a href="zhanshi.php?id=<?php echo $value['id']?>">点击进入</a>
            </td>
        </tr>
    <?php } ?>


</table>
